﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Web.Mvc;

namespace CoolCode.Web.Mvc.UI.Grid
{
    public class ToolbarRenderer : IToolbarRenderer
    {
        public void Render(IToolbarModel Model, TextWriter output, ViewContext viewContext)
        {
            output.Write("<div class=\"tDiv\">");
            output.Write("<div class=\"tDiv2\">");

            foreach (var button in Model.Buttons)
            {
                output.Write("<div class=\"fbutton\">");
                output.Write("<div>");
                output.Write(string.Format("<span class=\"{0}\">{1}</span></div>",
                    ((ToolbarButton)button).Css, ((ToolbarButton)button).Name));
                output.Write("</div>");
            }

            output.Write("</div>");
            output.Write("<div <div style=\"clear: both;\">");
            output.Write("</div>");
            output.Write("</div>");
        }
    }
}
